package org.admin.entity.vo;

import lombok.AccessLevel;
import lombok.Data;
import lombok.Setter;
import org.admin.entity.domain.File;

@Data
public class FileFetchVo {
    public FileFetchVo(){}
    public FileFetchVo(File file){
        setPath(file.getPath());
        name = file.getName();
        size = file.getSize();
        folderPath = file.getFolderPath();
        type = file.getType();
    }
    @Setter(AccessLevel.NONE)
    private String path;

    private String name;
    private Integer size;
    private String folderPath;

    private Integer type;
    private String format;

    private String icon;
    public void setPath(String value){
        path = value;
        icon = value.replaceAll("^(/|\\\\)?[^/\\\\]+", "/icon");
    }
}
